﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Yunwei.BizLogic;
using Yunwei.IBizLogic;
using Yunwei.Web.Models;

namespace Yunwei.Web.Controllers
{
    public class ChefController : Controller
    {
        IStaffService staffService;
        IFoodService foodService;
        public ChefController()
        {
            staffService = new StaffService();
            foodService = new FoodService();
        }

        // GET: Chef
        public ActionResult Detail(int id)
        {
            var chef = staffService.Find(id);
            if (chef == null || chef.Id <= 0)
            {
                return RedirectToAction("Error404", "Home");
            }
            
            var foods = foodService.FindList(20, "", 0, 0, id, null, null, 1);

            ChefViewModel cvm = new ChefViewModel();
            cvm.Staff = chef;
            cvm.Foods = foods.ToList();
            return View(cvm);
        }
    }
}